
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>流式计算Storm学习笔记 · tgor note</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="tgor">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../category/数据运营.html" />
    
    
    <link rel="prev" href="../category/OLAP.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Me
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../category/微服务.html">
            
                <a href="../category/微服务.html">
            
                    
                    微服务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../Java-Spring/Feign.html">
            
                <a href="../Java-Spring/Feign.html">
            
                    
                    HTTP客户端Feign
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../Java-其他库/限流.html">
            
                <a href="../Java-其他库/限流.html">
            
                    
                    限流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../运维/Nginx限流.html">
            
                <a href="../运维/Nginx限流.html">
            
                    
                    限流Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../Java-Spring/负载均衡.html">
            
                <a href="../Java-Spring/负载均衡.html">
            
                    
                    负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../运维/Nginx负载均衡.html">
            
                <a href="../运维/Nginx负载均衡.html">
            
                    
                    负载均衡Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../Java-其他库/熔断Hystrix.html">
            
                <a href="../Java-其他库/熔断Hystrix.html">
            
                    
                    熔断Hystrix
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../Java-其他库/缓存.html">
            
                <a href="../Java-其他库/缓存.html">
            
                    
                    缓存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../Java-其他库/缓存.html">
            
                <a href="../Java-其他库/缓存.html#本地缓存">
            
                    
                    本地缓存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html">
            
                    
                    分布式缓存Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../Java-其他库/分布式事务.html">
            
                <a href="../Java-其他库/分布式事务.html">
            
                    
                    分布式事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="../Java-其他库/分布式事务.html">
            
                <a href="../Java-其他库/分布式事务.html#事务消息">
            
                    
                    可靠事务消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="../Java-Spring/业务监控.html">
            
                <a href="../Java-Spring/业务监控.html">
            
                    
                    业务监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" data-path="../Java-其他库/分布式定时作业.html">
            
                <a href="../Java-其他库/分布式定时作业.html">
            
                    
                    分布式作业调度ElasticJob
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.14" data-path="../Java-ORM/ORM.html">
            
                <a href="../Java-ORM/ORM.html">
            
                    
                    ORM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.15" data-path="../Java-其他库/分布式系统及CAP原理.html">
            
                <a href="../Java-其他库/分布式系统及CAP原理.html">
            
                    
                    分布式系统及CAP原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.16" data-path="../MQ/RabbitMQ笔记.html">
            
                <a href="../MQ/RabbitMQ笔记.html">
            
                    
                    消息驱动Rabbitmq
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../category/数据库.html">
            
                <a href="../category/数据库.html">
            
                    
                    数据库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../Mysql/经典数据库设计案例.html">
            
                <a href="../Mysql/经典数据库设计案例.html">
            
                    
                    mysql设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../Mysql/Mysql事务与锁.html">
            
                <a href="../Mysql/Mysql事务与锁.html">
            
                    
                    mysql事务与锁
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../Mysql/mysql数据类型.html">
            
                <a href="../Mysql/mysql数据类型.html">
            
                    
                    mysql数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../Mysql/mysql索引及查询.html">
            
                <a href="../Mysql/mysql索引及查询.html">
            
                    
                    mysql索引与查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../Mysql/mysql索引及查询.html">
            
                <a href="../Mysql/mysql索引及查询.html#查询语句设计准则">
            
                    
                    mysql查询语句设计准则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../Mysql/mysql性能测试.html">
            
                <a href="../Mysql/mysql性能测试.html">
            
                    
                    mysql性能测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../Mysql/mysql主从同步与读写分离.html">
            
                <a href="../Mysql/mysql主从同步与读写分离.html">
            
                    
                    mysql主从同步与读写分离
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../Java-Spring/SpringBoot事务注解@Transactional.html">
            
                <a href="../Java-Spring/SpringBoot事务注解@Transactional.html">
            
                    
                    Spring事务注解@Transactional
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../数据结构与算法/位运算应用实例.html">
            
                <a href="../数据结构与算法/位运算应用实例.html">
            
                    
                    位运算应用实例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../Mongodb-Client/morphia-API汇总.html">
            
                <a href="../Mongodb-Client/morphia-API汇总.html">
            
                    
                    morphia API汇总
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../Mongodb-Client/mongo驱动连接.html">
            
                <a href="../Mongodb-Client/mongo驱动连接.html">
            
                    
                    mongodb驱动与连接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../Mongodb/mongodb-ObjectId实践.html">
            
                <a href="../Mongodb/mongodb-ObjectId实践.html">
            
                    
                    mongodb ObjectId实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../Mongodb/mongodb角色权限.html">
            
                <a href="../Mongodb/mongodb角色权限.html">
            
                    
                    mongodb角色权限
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../category/java并发.html">
            
                <a href="../category/java并发.html">
            
                    
                    Java并发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html">
            
                    
                    Java并发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html#锁">
            
                    
                    Java并发之锁设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html#synchronized">
            
                    
                    Java并发之synchronized
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../Java-Base/Java之Lock.html">
            
                <a href="../Java-Base/Java之Lock.html#reentrantlock">
            
                    
                    Java Lock之ReentrantLock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../Java-Base/Java之Lock.html">
            
                <a href="../Java-Base/Java之Lock.html#reentrantreadwritelock">
            
                    
                    Java Lock之ReentrantReadWriteLock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html">
            
                    
                    Java Future
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#futuretask">
            
                    
                    Java Future之FutureTask
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#completablefuture">
            
                    
                    Java Future之CompletableFuture
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#forkjointask">
            
                    
                    Java Future之ForkJoinTask
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../Java-Base/Java之Thread.html">
            
                <a href="../Java-Base/Java之Thread.html">
            
                    
                    Java Thread
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../category/redis.html">
            
                <a href="../category/redis.html">
            
                    
                    Redis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html">
            
                    
                    Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#集群">
            
                    
                    Redis集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#消息订阅">
            
                    
                    Redis消息订阅
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#lua">
            
                    
                    Redis Lua脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#配置汇总">
            
                    
                    Redis配置汇总
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../category/运维.html">
            
                <a href="../category/运维.html">
            
                    
                    运维
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../运维/Linux常用操作汇总.html">
            
                <a href="../运维/Linux常用操作汇总.html">
            
                    
                    Linux常用操作汇总
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../运维/阿里云笔记.html">
            
                <a href="../运维/阿里云笔记.html">
            
                    
                    阿里云笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../category/nginx.html">
            
                <a href="../category/nginx.html">
            
                    
                    Nginx
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../运维/Nginx学习笔记.html">
            
                <a href="../运维/Nginx学习笔记.html">
            
                    
                    Nginx基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../运维/Nginx负载均衡.html">
            
                <a href="../运维/Nginx负载均衡.html">
            
                    
                    Nginx负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../运维/Nginx限流.html">
            
                <a href="../运维/Nginx限流.html">
            
                    
                    Nginx限流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../运维/Nginx学习笔记.html">
            
                <a href="../运维/Nginx学习笔记.html#六、其他">
            
                    
                    Nginx客户端辅助技巧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../category/容器化.html">
            
                <a href="../category/容器化.html">
            
                    
                    容器化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html">
            
                    
                    Docker学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html#基础操作">
            
                    
                    Docker基础操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html#dockerfile">
            
                    
                    DockerFile
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../category/Web.html">
            
                <a href="../category/Web.html">
            
                    
                    Web
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../运维/Http入坑Https笔记.html">
            
                <a href="../运维/Http入坑Https笔记.html">
            
                    
                    Http入坑Https笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../Web/阿里云OSS.html">
            
                <a href="../Web/阿里云OSS.html">
            
                    
                    OSS
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../category/java基础.html">
            
                <a href="../category/java基础.html">
            
                    
                    Java基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#jvm">
            
                    
                    JVM基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#语法糖">
            
                    
                    Java语法糖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#数据结构">
            
                    
                    Java数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../Java-Base/Java8函数式编程.html">
            
                <a href="../Java-Base/Java8函数式编程.html">
            
                    
                    java8函数式编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../Java-Base/ArrayList源码分析.html">
            
                <a href="../Java-Base/ArrayList源码分析.html">
            
                    
                    JDK源码分析ArrayList
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../Java-Base/HashMap源码分析.html">
            
                <a href="../Java-Base/HashMap源码分析.html">
            
                    
                    JDK源码分析HashMap
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../Java-Base/Java注解.html">
            
                <a href="../Java-Base/Java注解.html">
            
                    
                    Java注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../Java-Base/Timsort排序算法.html">
            
                <a href="../Java-Base/Timsort排序算法.html">
            
                    
                    Timsort排序算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" data-path="../Java-Base/插入排序分析与Java实现.html">
            
                <a href="../Java-Base/插入排序分析与Java实现.html">
            
                    
                    插入排序分析与Java实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../category/工具与规范.html">
            
                <a href="../category/工具与规范.html">
            
                    
                    工具与规范
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../工具/Maven使用技巧汇总.html">
            
                <a href="../工具/Maven使用技巧汇总.html">
            
                    
                    Maven使用技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../编码规范/Java编码规范.html">
            
                <a href="../编码规范/Java编码规范.html">
            
                    
                    Java编码规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../category/OLAP.html">
            
                <a href="../category/OLAP.html">
            
                    
                    OLAP
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.12.1" data-path="storm学习笔记.html">
            
                <a href="storm学习笔记.html">
            
                    
                    流式计算Storm学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../category/数据运营.html">
            
                <a href="../category/数据运营.html">
            
                    
                    数据运营
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../数据运营/增长黑客数据运营.html">
            
                <a href="../数据运营/增长黑客数据运营.html">
            
                    
                    增长黑客-数据运营
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../category/前端技术栈.html">
            
                <a href="../category/前端技术栈.html">
            
                    
                    前端技术栈
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../前端/JavaScript设计模式.html">
            
                <a href="../前端/JavaScript设计模式.html">
            
                    
                    JavaScript设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../前端/html相对路径与绝对路径.html">
            
                <a href="../前端/html相对路径与绝对路径.html">
            
                    
                    Html相对路径与绝对路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../前端/微信小程序学习笔记.html">
            
                <a href="../前端/微信小程序学习笔记.html">
            
                    
                    微信小程序学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../category/个人.html">
            
                <a href="../category/个人.html">
            
                    
                    个人
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../个人/简历.html">
            
                <a href="../个人/简历.html">
            
                    
                    简历
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >流式计算Storm学习笔记</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="storm&#x5B66;&#x4E60;&#x7B14;&#x8BB0;">storm&#x5B66;&#x4E60;&#x7B14;&#x8BB0;</h1>
<h2 id="&#x4E00;&#x3001;&#x6982;&#x8FF0;">&#x4E00;&#x3001;&#x6982;&#x8FF0;</h2>
<p><strong>Storm&#xFF1A;&#x5F00;&#x6E90;&#x7684;&#x3001;&#x5206;&#x5E03;&#x5F0F;&#x3001;&#x6D41;&#x5F0F;&#x8BA1;&#x7B97;&#x7CFB;&#x7EDF;</strong></p>
<p><strong>Hadoop&#xFF1A;&#x6279;&#x91CF;&#x8BA1;&#x7B97;&#x751F;&#x6001;&#x7CFB;&#x7EDF;</strong></p>
<p>Hadoop&#x7279;&#x70B9;&#xFF1A;&#x53EA;&#x80FD;&#x5904;&#x7406;&#x9002;&#x5408;&#x8FDB;&#x884C;&#x6279;&#x91CF;&#x8BA1;&#x7B97;&#x7684;&#x9700;&#x6C42;&#x3002;&#x5BF9;&#x4E8E;&#xFF0C;&#x975E;&#x6279;&#x91CF;&#x7684;&#x8BA1;&#x7B97;&#x5C31;&#x4E0D;&#x80FD;&#x591F;&#x6EE1;&#x8DB3;&#x8981;&#x6C42;&#x4E86;&#x3002;
&#x5F88;&#x591A;&#x65F6;&#x5019;&#xFF0C;&#x5176;&#x5E94;&#x7528;&#x53EA;&#x80FD;&#x5148;&#x6536;&#x96C6;&#x4E00;&#x6BB5;&#x65F6;&#x95F4;&#x6570;&#x636E;&#xFF0C;&#x7B49;&#x6570;&#x636E;&#x6536;&#x96C6;&#x5230;&#x4E00;&#x5B9A;&#x89C4;&#x6A21;&#x4E4B;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x624D;&#x5F00;&#x59CB;MapReduce&#x5904;&#x7406;&#x3002;</p>
<p>&#x6279;&#x91CF;&#x8BA1;&#x7B97;&#x4E0E;&#x6D41;&#x5F0F;&#x8BA1;&#x7B97;&#x7684;&#x533A;&#x522B;
<img src="http://static.zybuluo.com/zero1036/t9l90fhy8wz47za9s3r9cfq2/image_1c9ia0hu5frvag4q1151kjb49.png" alt="image_1c9ia0hu5frvag4q1151kjb49.png-127.6kB"></p>
<p>&#x65E0;&#x8BBA;Storm&#x6216;Hadoop&#x751F;&#x6001;&#xFF0C;&#x672C;&#x8D28;&#x90FD;&#x662F;&#x628A;&#x4E00;&#x4E2A;&#x4EFB;&#x52A1;&#x62C6;&#x89E3;&#x7ED9;&#x591A;&#x4E2A;&#x8BA1;&#x7B97;&#x673A;&#x53BB;&#x6267;&#x884C;&#xFF0C;&#x5BF9;&#x5916;&#x53EA;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#x63A5;&#x53E3;
<img src="http://static.zybuluo.com/zero1036/f6337ya1c0rw889cbf6vvaux/image_1c9ia2t3qvii1jeue141jj715srm.png" alt="image_1c9ia2t3qvii1jeue141jj715srm.png-103.4kB"></p>
<hr>
<h2 id="&#x4E8C;&#x3001;&#x5185;&#x90E8;&#x673A;&#x5236;">&#x4E8C;&#x3001;&#x5185;&#x90E8;&#x673A;&#x5236;</h2>
<h3 id="&#x8FD0;&#x4F5C;&#x6A21;&#x5F0F;">&#x8FD0;&#x4F5C;&#x6A21;&#x5F0F;</h3>
<p>topology&#x8FD0;&#x4F5C;&#x6A21;&#x5F0F;&#xFF1A;spout &#x4EE3;&#x8868;&#x4E86;&#x4E00;&#x4E2A; Storm topology&#x7684;&#x4E3B;&#x8981;&#x6570;&#x636E;&#x5165;&#x53E3;&#xFF0C;&#x5145;&#x5F53;&#x91C7;&#x96C6;&#x5668;&#x7684;&#x89D2;&#x8272;&#xFF0C;&#x8FDE;&#x63A5;&#x5230;&#x6570;&#x636E;&#x6E90;&#xFF0C;&#x5C06;&#x6570;&#x636E;&#x8F6C;&#x5316;&#x4E3A;&#x4E00;&#x4E2A;&#x4E2A; tuple&#xFF0C;&#x5E76;&#x5C06; tuple &#x4F5C;&#x4E3A;&#x6570;&#x636E;&#x6D41;&#x8FDB;&#x884C;&#x53D1;&#x5C04;&#x3002;</p>
<p>bolt &#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E3A;&#x8BA1;&#x7B97;&#x7A0B;&#x5E8F;&#x4E2D;&#x7684;&#x8FD0;&#x7B97;&#x6216;&#x8005;&#x51FD;&#x6570;&#xFF0C;&#x5C06;&#x4E00;&#x4E2A;&#x6216;&#x8005;&#x591A;&#x4E2A;&#x6570;&#x636E;&#x6D41;&#x4F5C;&#x4E3A;&#x8F93;&#x5165;&#xFF0C;&#x5BF9;&#x6570;&#x636E;&#x5B9E;&#x65BD;&#x8FD0;&#x7B97;&#x540E;&#xFF0C;&#x9009;&#x62E9;&#x6027;&#x5730;&#x8F93;&#x51FA;&#x4E00;&#x4E2A;&#x6216;&#x8005;&#x591A;&#x4E2A;&#x6570;&#x636E;&#x6D41;&#x3002; bolt &#x53EF;&#x4EE5;&#x8BA2;&#x9605;&#x591A;&#x4E2A;&#x7531; spout &#x6216;&#x8005;&#x5176;&#x4ED6;bolt&#x53D1;&#x5C04;&#x7684;&#x6570;&#x636E;&#x6D41;&#xFF0C;&#x8FD9;&#x6837;&#x5C31;&#x53EF;&#x4EE5;&#x5EFA;&#x7ACB;&#x590D;&#x6742;&#x7684;&#x6570;&#x636E;&#x6D41;&#x8F6C;&#x6362;&#x7F51;&#x7EDC;&#x3002;</p>
<p><img src="http://static.zybuluo.com/zero1036/jpj9c5ft56vnsokyyqrq7h6o/image_1c9ib085n1i3q1ivn17bi1sh11jjo1n.png" alt="image_1c9ib085n1i3q1ivn17bi1sh11jjo1n.png-81.3kB"></p>
<p><img src="http://static.zybuluo.com/zero1036/gzk3ryk6okl5aeo48hbce6ve/20141202192541361.png" alt="20141202192541361.png-39.4kB"></p>
<h3 id="&#x6A21;&#x5757;&#x5173;&#x7CFB;">&#x6A21;&#x5757;&#x5173;&#x7CFB;</h3>
<p>&#x6574;&#x4E2A;&#x96C6;&#x7FA4;&#x7EF4;&#x5EA6;&#xFF1A;</p>
<ol>
<li>Nimbus</li>
<li>Supervisor</li>
</ol>
<p>&#x5355;&#x4E2A;&#x62D3;&#x6251;&#x7EF4;&#x5EA6;&#xFF1A;</p>
<ol>
<li>&#x7EC4;&#x4EF6;&#xFF08;component&#x5305;&#x542B;spout&#x4E0E;bolt&#xFF09;</li>
<li>&#x8FDB;&#x7A0B;&#xFF08;worker&#xFF09;</li>
<li>&#x6267;&#x884C;&#x5668;&#xFF08;executor&#xFF09;</li>
<li>task&#xFF08;&#x4EFB;&#x52A1;&#xFF09;</li>
</ol>
<p>&#x5176;&#x5173;&#x7CFB;&#x5982;&#x4E0B;&#x8FD0;&#x884C;&#x793A;&#x4F8B;&#xFF1A;</p>
<p><img src="http://static.zybuluo.com/zero1036/7v85a13ac1s1ohg1u13g1b81/example-of-a-running-topology.png" alt="example-of-a-running-topology.png-79.5kB"></p>
<p>&#x4E0B;&#x56FE;&#x663E;&#x793A;&#x4E86;&#x7B80;&#x5355;&#x7684; topology&#xFF08;&#x62D3;&#x6251;&#xFF09;&#x662F;&#x5982;&#x4F55;&#x8FD0;&#x884C;&#x7684;. &#x8BE5; topology &#x7531; 3 &#x4E2A; components&#xFF08;&#x7EC4;&#x4EF6;&#xFF09;&#x6784;&#x6210;: &#x4E00;&#x4E2A;&#x540D;&#x4E3A; BlueSpout &#x7684; spout &#x548C;&#x4E24;&#x4E2A;&#x540D;&#x4E3A; GreenBolt &#x548C; YellowBolt &#x7684; bolts. &#x8BE5;&#x7EC4;&#x4EF6;&#x94FE;&#x63A5;, &#x4F7F;&#x5F97; BlueSpout &#x5C06;&#x5176;&#x8F93;&#x51FA;&#x53D1;&#x9001;&#x5230; GreenBolt, &#x5B83;&#x4EEC;&#x5C06;&#x81EA;&#x5DF1;&#x7684;&#x8F93;&#x51FA;&#x53D1;&#x9001;&#x5230; YellowBolt&#x3002;</p>
<blockquote>
<p>note&#xFF1A;
  1.&#x62D3;&#x6251;&#xFF08;topology&#xFF09;&#x5728;&#x5206;&#x5E03;&#x5F0F;&#x96C6;&#x7FA4;&#x4E2D;&#x540C;&#x65F6;&#x8FD0;&#x884C;&#x591A;&#x4E2A;&#x8FDB;&#x7A0B;&#xFF08;woker&#xFF09;
  2.&#x5355;&#x4E2A;&#x8FDB;&#x7A0B;&#x8FD0;&#x884C;&#x591A;&#x4E2A;&#x6267;&#x884C;&#x5668;/&#x7EBF;&#x7A0B;&#xFF08;executor&#xFF09;&#xFF0C;&#x6BCF;&#x4E2A;&#x6267;&#x884C;&#x5668;&#x9ED8;&#x8BA4;&#x6301;&#x6709;&#x4E00;&#x4E2A;&#x4EFB;&#x52A1;&#xFF08;task&#xFF09;&#xFF0C;&#x53EF;&#x8BBE;&#x7F6E;&#x591A;&#x4E2A;
  3.&#x5355;&#x4E2A;&#x4EFB;&#x52A1;&#x5BF9;&#x5E94;&#x5355;&#x4E2A;&#x7EC4;&#x4EF6;&#x7684;&#x5B9E;&#x4F8B;&#xFF0C;&#x56E0;&#x6B64;&#x5B9E;&#x4F8B;&#x4E2D;&#x53D8;&#x91CF;&#x4E0D;&#x5171;&#x4EAB;&#x3001;&#x7EBF;&#x7A0B;&#x5B89;&#x5168;</p>
</blockquote>
<p>code example&#xFF1A;</p>
<pre><code class="lang-java">Config conf = <span class="hljs-keyword">new</span> Config();
conf.setNumWorkers(<span class="hljs-number">2</span>); <span class="hljs-comment">// use two worker processes</span>

topologyBuilder.setSpout(<span class="hljs-string">&quot;blue-spout&quot;</span>, <span class="hljs-keyword">new</span> BlueSpout(), <span class="hljs-number">2</span>); <span class="hljs-comment">// set parallelism hint to 2</span>

topologyBuilder.setBolt(<span class="hljs-string">&quot;green-bolt&quot;</span>, <span class="hljs-keyword">new</span> GreenBolt(), <span class="hljs-number">2</span>)
               .setNumTasks(<span class="hljs-number">4</span>)
               .shuffleGrouping(<span class="hljs-string">&quot;blue-spout&quot;</span>);

topologyBuilder.setBolt(<span class="hljs-string">&quot;yellow-bolt&quot;</span>, <span class="hljs-keyword">new</span> YellowBolt(), <span class="hljs-number">6</span>)
               .shuffleGrouping(<span class="hljs-string">&quot;green-bolt&quot;</span>);

StormSubmitter.submitTopology(
        <span class="hljs-string">&quot;mytopology&quot;</span>,
        conf,
        topologyBuilder.createTopology()
    );
</code></pre>
<p>&#x901A;&#x8FC7;&#x793A;&#x4F8B;&#x53EF;&#x77E5;&#xFF0C;topology&#x4E2D;&#x5171;&#x6709;2&#x4E2A;worker&#x8FDB;&#x7A0B;&#xFF0C;12&#x4E2A;task&#xFF08;2+2+6&#xFF09;&#xFF0C;10&#x4E2A;executor</p>
<p>&#x540C;&#x4E00;&#x4E2A;component&#x4E0D;&#x540C;task&#x4E4B;&#x95F4;&#xFF0C;&#x53D8;&#x91CF;&#x4E0D;&#x5171;&#x4EAB;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">TaskMain</span> </span>{
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">final</span> String TOPOLOGY_NAME = <span class="hljs-string">&quot;test-task-topology&quot;</span>;

    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">TaskTestBolt</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">BaseRichBolt</span> </span>{
        OutputCollector _collector;

        <span class="hljs-keyword">private</span> Integer count;
        <span class="hljs-keyword">private</span> StringBuilder builder;

        <span class="hljs-meta">@Override</span>
        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">prepare</span><span class="hljs-params">(Map conf, TopologyContext context,
                            OutputCollector collector)</span> </span>{
            _collector = collector;
            count = <span class="hljs-number">0</span>;
            builder = <span class="hljs-keyword">new</span> StringBuilder();
        }

        <span class="hljs-meta">@Override</span>
        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">execute</span><span class="hljs-params">(Tuple tuple)</span> </span>{
            count++;
            String word = tuple.getStringByField(<span class="hljs-string">&quot;word&quot;</span>);
            builder.append(word).append(<span class="hljs-string">&quot;-&quot;</span>);
            System.out.println(<span class="hljs-string">&quot;word:&quot;</span> + builder.toString() + <span class="hljs-string">&quot; metric:&quot;</span> + count);
            _collector.ack(tuple);
        }

        <span class="hljs-meta">@Override</span>
        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">declareOutputFields</span><span class="hljs-params">(OutputFieldsDeclarer declarer)</span> </span>{
        }
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        TopologyBuilder builder = <span class="hljs-keyword">new</span> TopologyBuilder();

        builder.setSpout(<span class="hljs-string">&quot;wordSpout&quot;</span>, <span class="hljs-keyword">new</span> TestWordSpout(), <span class="hljs-number">1</span>);
        builder.setBolt(<span class="hljs-string">&quot;taskBolt&quot;</span>, <span class="hljs-keyword">new</span> TaskTestBolt(), <span class="hljs-number">1</span>) <span class="hljs-comment">//&#x5355;&#x4E2A;executor</span>
                .setNumTasks(<span class="hljs-number">2</span>)                            <span class="hljs-comment">//2&#x4E2A;task</span>
                .shuffleGrouping(<span class="hljs-string">&quot;wordSpout&quot;</span>);
        Config conf = <span class="hljs-keyword">new</span> Config();
        conf.setDebug(<span class="hljs-keyword">true</span>);

        LocalCluster cluster = <span class="hljs-keyword">new</span> LocalCluster();
        cluster.submitTopology(TOPOLOGY_NAME, conf, builder.createTopology());

        Utils.sleep(<span class="hljs-number">10000</span>);
        cluster.killTopology(TOPOLOGY_NAME);
        cluster.shutdown();
    }
}

<span class="hljs-comment">//output result</span>
word:nathan-jackson-jackson-nathan-jackson-bertels-jackson- metric:<span class="hljs-number">7</span>
<span class="hljs-number">7857</span> [Thread-<span class="hljs-number">14</span>-taskBolt-executor[<span class="hljs-number">2</span> <span class="hljs-number">3</span>]] INFO  o.a.s.d.executor - BOLT ack TASK: <span class="hljs-number">3</span> TIME:  TUPLE: source: wordSpout:<span class="hljs-number">4</span>, stream: <span class="hljs-keyword">default</span>, id: {}, [jackson]
<span class="hljs-number">7857</span> [Thread-<span class="hljs-number">14</span>-taskBolt-executor[<span class="hljs-number">2</span> <span class="hljs-number">3</span>]] INFO  o.a.s.d.executor - Execute done TUPLE source: wordSpout:<span class="hljs-number">4</span>, stream: <span class="hljs-keyword">default</span>, id: {}, [jackson] TASK: <span class="hljs-number">3</span> DELTA: 
<span class="hljs-number">7955</span> [Thread-<span class="hljs-number">20</span>-wordSpout-executor[<span class="hljs-number">4</span> <span class="hljs-number">4</span>]] INFO  o.a.s.d.task - Emitting: wordSpout <span class="hljs-keyword">default</span> [golda]
<span class="hljs-number">7955</span> [Thread-<span class="hljs-number">20</span>-wordSpout-executor[<span class="hljs-number">4</span> <span class="hljs-number">4</span>]] INFO  o.a.s.d.executor - TRANSFERING tuple [dest: <span class="hljs-number">2</span> tuple: source: wordSpout:<span class="hljs-number">4</span>, stream: <span class="hljs-keyword">default</span>, id: {}, [golda]]
<span class="hljs-number">7957</span> [Thread-<span class="hljs-number">14</span>-taskBolt-executor[<span class="hljs-number">2</span> <span class="hljs-number">3</span>]] INFO  o.a.s.d.executor - Processing received message FOR <span class="hljs-number">2</span> TUPLE: source: wordSpout:<span class="hljs-number">4</span>, stream: <span class="hljs-keyword">default</span>, id: {}, [golda]
word:jackson-golda- metric:<span class="hljs-number">2</span>
</code></pre>
<p>&#x5E76;&#x884C;&#x5EA6;&#x5177;&#x4F53;&#x914D;&#x7F6E;&#x53C2;&#x8003;&#xFF1A;<a href="http://storm.apachecn.org/releases/cn/1.1.0/Understanding-the-parallelism-of-a-Storm-topology.html" target="_blank">http://storm.apachecn.org/releases/cn/1.1.0/Understanding-the-parallelism-of-a-Storm-topology.html</a></p>
<hr>
<h2 id="&#x4E09;&#x3001;&#x6D88;&#x606F;&#x53EF;&#x9760;&#x6027;">&#x4E09;&#x3001;&#x6D88;&#x606F;&#x53EF;&#x9760;&#x6027;</h2>
<p><img src="http://static.zybuluo.com/zero1036/mtcldefh9jrgad0v24nm8ryt/image_1c9iafq2e1l1g1aif1s55qp119ph1a.png" alt="image_1c9iafq2e1l1g1aif1s55qp119ph1a.png-71.1kB"></p>
<p>&#x5728;Storm&#x4E2D;&#xFF0C;&#x6D88;&#x606F;&#x5904;&#x7406;&#x53EF;&#x9760;&#x6027;&#x4ECE;Spout&#x5F00;&#x59CB;&#x7684;&#x3002;storm&#x4E3A;&#x4E86;&#x4FDD;&#x8BC1;&#x6570;&#x636E;&#x80FD;&#x6B63;&#x786E;&#x7684;&#x88AB;&#x5904;&#x7406;&#xFF0C;&#x5BF9;&#x4E8E;spout&#x4EA7;&#x751F;&#x7684;&#x6BCF;&#x4E00;&#x4E2A;tuple,storm&#x90FD;&#x80FD;&#x591F;&#x8FDB;&#x884C;&#x8DDF;&#x8E2A;,&#x8FD9;&#x91CC;&#x9762;&#x6D89;&#x53CA;&#x5230;&#x4E86;ack/fail&#x7684;&#x5904;&#x7406;, &#x5982;&#x679C;&#x4E00;&#x4E2A;tuple&#x88AB;&#x5904;&#x7406;&#x6210;&#x529F;,&#x90A3;&#x4E48;spout&#x4FBF;&#x4F1A;&#x8C03;&#x7528;&#x5176;ack&#x65B9;&#x6CD5;,&#x5982;&#x679C;&#x5931;&#x8D25;,&#x5219;&#x4F1A;&#x8C03;&#x7528;fail&#x65B9;&#x6CD5;&#x3002;&#x800C;topology&#x4E2D;&#x5904;&#x7406;tuple&#x7684;&#x6BCF;&#x4E00;&#x4E2A;bolt&#x90FD;&#x4F1A;&#x901A;&#x8FC7;OutputCollector&#x6765;&#x544A;&#x77E5;storm,&#x5F53;&#x524D;bolt&#x5904;&#x7406;&#x662F;&#x5426;&#x6210;&#x529F;&#x3002;
     &#x6211;&#x4EEC;&#x77E5;&#x9053;spout&#x5FC5;&#x987B;&#x80FD;&#x591F;&#x8FFD;&#x8E2A;&#x5B83;&#x53D1;&#x5C04;&#x7684;&#x6240;&#x6709;tuples&#x6216;&#x5176;&#x5B50;tuples&#xFF0C;&#x5E76;&#x4E14;&#x5728;&#x8FD9;&#x4E9B;tuples&#x5904;&#x7406;&#x5931;&#x8D25;&#x65F6;&#x80FD;&#x591F;&#x91CD;&#x53D1;&#x3002;&#x90A3;&#x4E48;spout&#x5982;&#x4F55;&#x8FFD;&#x8E2A;tuple&#x5462;&#xFF1F;storm&#x662F;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;anchor&#x673A;&#x5236;&#x6765;&#x5B9E;&#x73B0;&#x7684;&#xFF08;&#x5728;&#x4E0B;&#x9762;&#x7684;bolt&#x53EF;&#x9760;&#x6027;&#x4E2D;&#x4F1A;&#x8BB2;&#x5230;&#xFF09;&#x3002;</p>
<ol>
<li>bolt&#x628A;&#x5143;&#x7EC4;&#x4F5C;&#x4E3A;&#x8F93;&#x5165;&#xFF0C;&#x7136;&#x540E;&#x4EA7;&#x751F;&#x65B0;&#x7684;&#x5143;&#x7EC4;&#x4F5C;&#x4E3A;&#x8F93;&#x51FA;&#xFF1B;</li>
<li>&#x53EF;&#x9760;&#x6027;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5143;&#x7EC4;&#x6811;&#x7684;&#x4EFB;&#x610F;&#x8282;&#x70B9;&#x53D1;&#x751F;&#x5904;&#x7406;&#x5931;&#x8D25;&#x5C06;&#x4F1A;&#x4F20;&#x5BFC;&#x5230;&#x5176;&#x6839;&#x8282;&#x70B9;&#x7684;tuple&#x4E0A;&#xFF08;&#x5373;spout&#x53D1;&#x51FA;&#x7684;tuple&#xFF09;</li>
<li>&#x5143;&#x7EC4;&#x5728;&#x4E2D;&#x5C42;bolt&#x5904;&#x7406;&#x4E2D;&#x88AB;&#x4E22;&#x5F03;&#xFF08;&#x6CA1;&#x6709;&#x4F20;&#x5BFC;&#x5230;&#x4E0B;&#x4E00;&#x5C42;bolt&#xFF09;&#x540C;&#x65F6;&#x53C8;&#x88AB;ack&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x8BE5;&#x5143;&#x7EC4;&#x7684;&#x6839;&#x8282;&#x70B9;&#x5143;&#x7EC4;&#x5C06;&#x4F1A;ack&#xFF1B;</li>
<li>&#x53EF;&#x9760;&#x6027;&#x5B9E;&#x73B0;&#x65B9;&#x5F0F;&#xFF1A;spout&#x53D1;&#x5C04;&#x6D88;&#x606F;&#x4F20;&#x9012;messageId&#xFF0C;bolt&#x53D1;&#x5C04;&#x6D88;&#x606F;&#x65F6;&#x4F20;&#x9012;&#x63A5;&#x6536;&#x5143;&#x7EC4;&#xFF08;<strong>Question</strong>:Kestrel&#x6D88;&#x606F;&#x961F;&#x5217;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x5176;&#x6D88;&#x606F;&#x81EA;&#x5E26;&#x7684;&#x7F16;&#x53F7;&#xFF0C;rabbitMq&#x662F;&#x5426;&#x53EF;&#x4EE5;&#xFF1F;&#x5982;&#x679C;&#x4E0D;&#x53EF;&#x4EE5;&#xFF0C;&#x5982;&#x4F55;&#x751F;&#x6210;&#x5168;&#x5C40;&#x552F;&#x4E00;&#x6709;&#x5E8F;&#x6D88;&#x606F;Id&#xFF1F;2&#x7248;&#x6731;&#x96C0;&#x8C03;&#x5EA6;&#x670D;&#x52A1;&#x6309;&#x4E8B;&#x4EF6;&#x7C7B;&#x578B;&#x5206;&#x7EC4;&#xFF0C;MongoDB&#x751F;&#x6210;&#x552F;&#x4E00;Id&#xFF09;</li>
</ol>
<hr>
<h2 id="&#x56DB;&#x3001;&#x6570;&#x636E;&#x6D41;&#x7EC4;">&#x56DB;&#x3001;&#x6570;&#x636E;&#x6D41;&#x7EC4;</h2>
<p><strong>&#x968F;&#x673A;&#x6570;&#x636E;&#x6D41;&#x7EC4;&#xFF08;shuffleGrouping&#xFF09;</strong>&#xFF1A;&#x968F;&#x673A;&#x6D41;&#x7EC4;&#x662F;&#x6700;&#x5E38;&#x7528;&#x7684;&#x6570;&#x636E;&#x6D41;&#x7EC4;&#x3002;&#x5B83;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#xFF08;&#x6570;&#x636E;&#x6E90;&#x7EC4;&#x4EF6;&#xFF09;&#xFF0C;&#x5E76;&#x4E14;&#x6570;&#x636E;&#x6E90;&#x4F1A;&#x5411;&#x968F;&#x673A;&#x9009;&#x62E9;&#x7684; bolt &#x53D1;&#x9001;&#x5143;&#x7EC4;&#xFF0C;&#x6BCF;&#x4E2A;bolt&#x5B9E;&#x4F8B;&#x63A5;&#x6536;&#x5230;&#x7684;&#x76F8;&#x540C;&#x6570;&#x91CF;&#x7684;tuple</p>
<p><strong>&#x6309;&#x5B57;&#x6BB5;&#x5206;&#x7EC4;&#xFF08;fieldsGrouping&#xFF09;</strong>&#xFF1A;&#x6839;&#x636E;&#x6307;&#x5B9A;&#x5B57;&#x6BB5;&#x7684;&#x503C;&#x8FDB;&#x884C;&#x5206;&#x7EC4;&#x3002;&#x6BD4;&#x5982;&#x8BF4;&#xFF0C;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x6D41;&#x6839;&#x636E;&#x201C;word&#x201D;&#x5B57;&#x6BB5;&#x8FDB;&#x884C;&#x5206;&#x7EC4;&#xFF0C;&#x6240;&#x6709;&#x5177;&#x6709;&#x76F8;&#x540C;&#x201C;word&#x201D;&#x5B57;&#x6BB5;&#x503C;&#x7684;tuple&#x4F1A;&#x8DEF;&#x7531;&#x5230;&#x540C;&#x4E00;&#x4E2A;bolt&#x7684;task&#x4E2D;&#x3002;<strong>&#x6CE8;&#x610F;</strong>&#xFF1A;&#x5F53;bolt&#x8BBE;&#x7F6E;&#x7684;task&#x6570;&#x91CF;&#x5C11;&#x4E8E;word&#x7684;&#x79CD;&#x7C7B;&#x65F6;&#xFF0C;&#x76F8;&#x540C;&#x79CD;&#x7C7B;&#x7684;work&#x540C;&#x6837;&#x4F1A;&#x8DEF;&#x7531;&#x5230;&#x540C;&#x4E00;&#x4E2A;bolt&#x7684;task&#x4E2D;&#xFF0C;&#x95EE;&#x9898;&#x662F;bolt&#x7684;task&#x6570;&#x91CF;&#x9700;&#x8981;&#x5728;topology&#x6784;&#x5EFA;&#x65F6;&#x786E;&#x5B9A;&#xFF0C;&#x662F;&#x5426;&#x53EF;&#x4EE5;&#x6839;&#x636E;work&#x7684;&#x79CD;&#x7C7B;&#x52A8;&#x6001;&#x589E;&#x52A0;</p>
<p><strong>&#x5168;&#x590D;&#x5236;&#x5206;&#x7EC4;&#xFF08;allGrouping&#xFF09;</strong>&#xFF1A;&#x5C06;&#x6240;&#x6709;&#x7684; tuple &#x590D;&#x5236;&#x540E;&#x5206;&#x53D1;&#x7ED9;&#x6240;&#x6709; bolt task&#x3002;&#x6BCF;&#x4E2A;&#x8BA2;&#x9605;&#x6570;&#x636E;&#x6D41;&#x7684; task &#x90FD;&#x4F1A;&#x63A5;&#x6536;&#x5230; tuple &#x7684;&#x62F7;&#x8D1D;&#x3002;<strong>&#x6CE8;&#x610F;</strong>&#xFF1A;&#x62D3;&#x6251;&#x91CC;&#x7684;&#x6240;&#x6709;bolt&#x90FD;&#x5931;&#x8D25;&#x4E86;&#xFF0C;spout&#x7684;fail&#x65B9;&#x6CD5;&#x624D;&#x4F1A;&#x88AB;&#x8C03;&#x7528;&#xFF1B;&#x6362;&#x8A00;&#x4E4B;&#xFF0C;&#x53E6;&#x5916;&#x4E24;&#x4E2A;&#x6570;&#x636E;&#x6D41;&#x7EC4;&#xFF0C;&#x4EC5;&#x4E00;&#x4E2A;bolt fail&#x5C31;&#x4F1A;&#x5BFC;&#x81F4;spout&#x7684;fail</p>
<p><strong>&#x5168;&#x5C40;&#x5206;&#x7EC4;&#xFF08;globleGrouping&#xFF09;</strong>&#xFF1A;&#x8FD9;&#x79CD;&#x5206;&#x7EC4;&#x65B9;&#x5F0F;&#x5C06;&#x6240;&#x6709;&#x7684; tuples &#x8DEF;&#x7531;&#x5230;&#x552F;&#x4E00;&#x4E00;&#x4E2A; task&#x4E0A;&#x3002;Storm&#x6309;&#x7167;&#x6700;&#x5C0F;&#x7684; task ID &#x6765;&#x9009;&#x53D6;&#x63A5;&#x6536;&#x6570;&#x636E;&#x7684; task&#x3002;<strong>&#x6CE8;&#x610F;</strong>&#xFF1A;&#x5F53;&#x4F7F;&#x7528;&#x5168;&#x5C40;&#x5206;&#x7EC4;&#x65B9;&#x5F0F;&#x65F6;&#xFF0C;&#x8BBE;&#x7F6E;bolt&#x7684;task&#x5E76;&#x53D1;&#x5EA6;&#x662F;&#x6CA1;&#x6709;&#x610F;&#x4E49;&#x7684;&#xFF0C;&#x56E0;&#x4E3A;&#x6240;&#x6709;tuple&#x90FD;&#x8F6C;&#x53D1;&#x5230;&#x540C;&#x4E00;&#x4E2A; task &#x4E0A;&#x4E86;&#x3002;&#x4F7F;&#x7528;&#x5168;&#x5C40;&#x5206;&#x7EC4;&#x7684;&#x65F6;&#x5019;&#x9700;&#x8981;&#x6CE8;&#x610F;&#xFF0C;&#x56E0;&#x4E3A;&#x6240;&#x6709;&#x7684;tuple&#x90FD;&#x8F6C;&#x53D1;&#x5230;&#x4E00;&#x4E2A;JVM &#x5B9E;&#x4F8B;&#x4E0A;&#xFF0C;&#x53EF;&#x80FD;&#x4F1A;&#x5F15;&#x8D77; Storm &#x96C6;&#x7FA4;&#x4E2D;&#x67D0;&#x4E2A; JVM&#x6216;&#x8005;&#x670D;&#x52A1;&#x5668;&#x51FA;&#x73B0;&#x6027;&#x80FD;&#x74F6;&#x9888;&#x6216;&#x5D29;&#x6E83;&#x3002;</p>
<p><strong>&#x4E0D;&#x5206;&#x7EC4;&#xFF08;noneGrouping&#xFF09;</strong>&#xFF1A;&#x5728;&#x529F;&#x80FD;&#x4E0A;&#x548C;&#x968F;&#x673A;&#x5206;&#x7EC4;&#x76F8;&#x540C;&#xFF0C;&#x662F;&#x4E3A;&#x5C06;&#x6765;&#x9884;&#x7559;&#x7684;&#x3002;</p>
<p><strong>&#x6307;&#x5411;&#x578B;&#x5206;&#x7EC4;&#xFF08;directGrouping&#xFF09;</strong>&#xFF1A;&#x6570;&#x636E;&#x6E90;&#x4F1A;&#x8C03;&#x7528; emitDirect() &#x65B9;&#x6CD5;&#x6765;&#x5224;&#x65AD;&#x4E00;&#x4E2A; tuple &#x5E94;&#x8BE5;&#x7531;&#x54EA;&#x4E2A; Storm &#x7EC4;&#x4EF6;&#x6765;&#x63A5;&#x6536;&#x3002;&#x53EA;&#x80FD;&#x5728;&#x58F0;&#x660E;&#x4E86;&#x662F;&#x6307;&#x5411;&#x578B;&#x7684;&#x6570;&#x636E;&#x6D41;&#x4E0A;&#x4F7F;&#x7528;&#x3002;</p>
<p>fieldsGrouping task&#x6570;&#x91CF;&#x5C11;&#x4E8E;&#x5206;&#x7EC4;&#x503C;&#x79CD;&#x7C7B;&#x7684;code example&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">OneTaskForFieldsGroupingMain</span> </span>{
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">final</span> String TOPOLOGY_NAME = <span class="hljs-string">&quot;test-grouping-topology&quot;</span>;

    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">TaskTestBolt</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">BaseRichBolt</span> </span>{
        OutputCollector _collector;

        <span class="hljs-keyword">private</span> StringBuilder builder;

        <span class="hljs-meta">@Override</span>
        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">prepare</span><span class="hljs-params">(Map conf, TopologyContext context,
                            OutputCollector collector)</span> </span>{
            _collector = collector;
            builder = <span class="hljs-keyword">new</span> StringBuilder();
        }

        <span class="hljs-meta">@Override</span>
        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">execute</span><span class="hljs-params">(Tuple tuple)</span> </span>{
            String word = tuple.getStringByField(<span class="hljs-string">&quot;word&quot;</span>);
            builder.append(word).append(<span class="hljs-string">&quot;-&quot;</span>);
            System.out.println(<span class="hljs-string">&quot;word:&quot;</span> + builder.toString());
            _collector.ack(tuple);
        }

        <span class="hljs-meta">@Override</span>
        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">declareOutputFields</span><span class="hljs-params">(OutputFieldsDeclarer declarer)</span> </span>{
        }
    }


    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        TopologyBuilder builder = <span class="hljs-keyword">new</span> TopologyBuilder();

        builder.setSpout(<span class="hljs-string">&quot;wordSpout&quot;</span>, <span class="hljs-keyword">new</span> TestWordSpout(), <span class="hljs-number">1</span>);
        builder.setBolt(<span class="hljs-string">&quot;myBolt&quot;</span>, <span class="hljs-keyword">new</span> TaskTestBolt(), <span class="hljs-number">1</span>)
                .setNumTasks(<span class="hljs-number">2</span>)  <span class="hljs-comment">//2 task</span>
                .fieldsGrouping(<span class="hljs-string">&quot;wordSpout&quot;</span>, <span class="hljs-keyword">new</span> Fields(<span class="hljs-string">&quot;word&quot;</span>));
        Config conf = <span class="hljs-keyword">new</span> Config();
        conf.setDebug(<span class="hljs-keyword">true</span>);

        LocalCluster cluster = <span class="hljs-keyword">new</span> LocalCluster();
        cluster.submitTopology(TOPOLOGY_NAME, conf, builder.createTopology());

        Utils.sleep(<span class="hljs-number">10000</span>);
        cluster.killTopology(TOPOLOGY_NAME);
        cluster.shutdown();
    }
}

<span class="hljs-comment">//output result</span>
word:golda-jackson-bertels-jackson-golda-bertels-bertels-bertels-jackson-golda-jackson-jackson-jackson-jackson-jackson-jackson-jackson-jackson-jackson-bertels-bertels-

word:mike-mike-nathan-mike-mike-mike-mike-nathan-nathan-nathan-mike-
</code></pre>
<hr>
<h2 id="&#x4E94;&#x3001;&#x7EC4;&#x4EF6;spout-and-bolt">&#x4E94;&#x3001;&#x7EC4;&#x4EF6;spout and bolt</h2>
<h3 id="spout&#x5BF9;&#x63A5;&#x6D88;&#x606F;&#x961F;&#x5217;">spout&#x5BF9;&#x63A5;&#x6D88;&#x606F;&#x961F;&#x5217;</h3>
<p>spout&#x5BF9;&#x63A5;&#x53EF;&#x7528;&#x6570;&#x636E;&#x6E90;&#xFF1A;</p>
<ol>
<li>&#x6D88;&#x606F;&#x961F;&#x5217;&#xFF1A;Kalfa&#x3001;ActiveMQ&#x3001;RabbitMQ&#x3001;Kestrel</li>
<li>&#x6570;&#x636E;&#x5E93;</li>
<li>&#x5176;&#x4ED6;</li>
</ol>
<p>&#x5BF9;&#x63A5;rabbitmq&#x6D88;&#x606F;&#x961F;&#x5217;&#x4F5C;&#x4E3A;&#x6570;&#x636E;&#x6E90;</p>
<p>1.&#x5229;&#x7528;RabbitMQSpout&#x63A5;&#x6536;&#x6D88;&#x606F;</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Main</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        TopologyBuilder builder = <span class="hljs-keyword">new</span> TopologyBuilder();
        Scheme scheme = <span class="hljs-keyword">new</span> RabbitMQMessageScheme(<span class="hljs-keyword">new</span> MqScheme(), <span class="hljs-string">&quot;envelope&quot;</span>, <span class="hljs-string">&quot;properties&quot;</span>);
        IRichSpout spout = <span class="hljs-keyword">new</span> RabbitMQSpout(scheme);

        ConnectionConfig connectionConfig = <span class="hljs-keyword">new</span> ConnectionConfig(
                <span class="hljs-string">&quot;localhost&quot;</span>, <span class="hljs-number">5672</span>, <span class="hljs-string">&quot;guest&quot;</span>, <span class="hljs-string">&quot;guest&quot;</span>, ConnectionFactory.DEFAULT_VHOST, <span class="hljs-number">10</span>); <span class="hljs-comment">// host, port, username, password, virtualHost, heartBeat</span>
        ConsumerConfig spoutConfig = <span class="hljs-keyword">new</span> ConsumerConfigBuilder().connection(connectionConfig)
                .queue(<span class="hljs-string">&quot;testExchange-q1&quot;</span>)
                .prefetch(<span class="hljs-number">200</span>)
                .requeueOnFail()
                .build();

        builder.setSpout(<span class="hljs-string">&quot;my-spout&quot;</span>, spout)
                .addConfigurations(spoutConfig.asMap())
                .setMaxSpoutPending(<span class="hljs-number">200</span>);

        ...
    }          
}
</code></pre>
<p>&#x81EA;&#x5B9A;&#x4E49;Scheme&#xFF1A;MqScheme.class</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MqScheme</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">Scheme</span> </span>{
    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> List&lt;Object&gt; <span class="hljs-title">deserialize</span><span class="hljs-params">(ByteBuffer byteBuffer)</span> </span>{
        List result = Lists.newArrayListWithCapacity(<span class="hljs-number">1</span>);
        result.add(byteBufferToString(byteBuffer));
        <span class="hljs-keyword">return</span> result;
    }

    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> Fields <span class="hljs-title">getOutputFields</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> Fields(<span class="hljs-string">&quot;testMqMessage&quot;</span>);
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> String <span class="hljs-title">byteBufferToString</span><span class="hljs-params">(ByteBuffer buffer)</span> </span>{
        CharBuffer charBuffer = <span class="hljs-keyword">null</span>;
        <span class="hljs-keyword">try</span> {
            Charset charset = Charset.forName(<span class="hljs-string">&quot;UTF-8&quot;</span>);
            CharsetDecoder decoder = charset.newDecoder();
            charBuffer = decoder.decode(buffer);
            buffer.flip();
            <span class="hljs-keyword">return</span> charBuffer.toString();
        } <span class="hljs-keyword">catch</span> (Exception ex) {
            ex.printStackTrace();
            <span class="hljs-keyword">return</span> <span class="hljs-keyword">null</span>;
        }
    }
}
</code></pre>
<p>2.&#x5229;&#x7528;RabbitMQBolt&#x53D1;&#x9001;&#x6D88;&#x606F;
topology main&#x56FA;&#x5B9A;bolt&#x8F93;&#x51FA;&#x5B57;&#x6BB5;&#x65B9;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-java">TupleToMessage msg = <span class="hljs-keyword">new</span> TupleToMessageNonDynamic() {
    <span class="hljs-meta">@Override</span>
    <span class="hljs-keyword">protected</span> <span class="hljs-keyword">byte</span>[] extractBody(Tuple input) { 
        <span class="hljs-keyword">return</span> input.getStringByField(<span class="hljs-string">&quot;sendMsg&quot;</span>).getBytes(); 
    }
};

ProducerConfig sinkConfig = <span class="hljs-keyword">new</span> ProducerConfigBuilder()
    .connection(connectionConfig)
    .contentEncoding(<span class="hljs-string">&quot;UTF-8&quot;</span>)
    .contentType(<span class="hljs-string">&quot;application/json&quot;</span>)
    .exchange(<span class="hljs-string">&quot;testExchangeOutput&quot;</span>)
    .routingKey(<span class="hljs-string">&quot;&quot;</span>)
    .build();

builder.setBolt(<span class="hljs-string">&quot;send-msg-bolt&quot;</span>, <span class="hljs-keyword">new</span> RabbitMQBolt(msg))
    .addConfigurations(sinkConfig.asMap())
    .shuffleGrouping(<span class="hljs-string">&quot;my-bolt&quot;</span>);
</code></pre>
<hr>
<h3 id="spout&#x591A;&#x4E2A;executor&#xFF08;&#x7EBF;&#x7A0B;&#xFF09;">spout&#x591A;&#x4E2A;executor&#xFF08;&#x7EBF;&#x7A0B;&#xFF09;</h3>
<p>spout&#x591A;&#x4E2A;executor&#xFF08;&#x5373;&#x591A;&#x7EBF;&#x7A0B;&#xFF09;&#x5904;&#x7406;&#x65F6;&#xFF0C;&#x4F1A;&#x4EA7;&#x751F;&#x591A;&#x4EFD;&#x6570;&#x636E;&#x6D41;&#x8F93;&#x5165;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;</p>
<p>MainClass:</p>
<pre><code class="lang-java">    <span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x4E24;&#x4E2A;Executeor(&#x7EBF;&#x7A0B;)&#xFF0C;&#x9ED8;&#x8BA4;&#x4E00;&#x4E2A;</span>
    builder.setSpout(SENTENCE_SPOUT_ID, spout, <span class="hljs-number">2</span>);
</code></pre>
<p>SpoutClass:</p>
<pre><code class="lang-java">    <span class="hljs-keyword">private</span> Integer index = <span class="hljs-number">0</span>;
    <span class="hljs-keyword">private</span> String[] sentences = {
        <span class="hljs-string">&quot;a&quot;</span>,<span class="hljs-string">&quot;b&quot;</span>,<span class="hljs-string">&quot;c&quot;</span>
    };

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">nextTuple</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">if</span> (index &gt;= sentences.length) {
            index = <span class="hljs-number">0</span>;
            Utils.sleep(<span class="hljs-number">1000</span>);
            <span class="hljs-keyword">return</span>;
        } <span class="hljs-keyword">else</span> {
            <span class="hljs-keyword">this</span>.collector.emit(<span class="hljs-keyword">new</span> Values(sentences[index]), index);
            index++;
        }
        Utils.sleep(<span class="hljs-number">1</span>);
    }
</code></pre>
<p>boltClass:</p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">execute</span><span class="hljs-params">(Tuple input)</span> </span>{
        String sentence = input.getStringByField(<span class="hljs-string">&quot;sentence&quot;</span>);
        System.out.println(<span class="hljs-string">&quot;bolt is workding:&quot;</span> + sentence);
    }
</code></pre>
<p>console&#xFF1A;</p>
<pre><code>//spout&#x5355;&#x7EBF;&#x7A0B;&#x4E0B;&#xFF08;&#x9ED8;&#x8BA4;&#x5355;&#x7EBF;&#x7A0B;&#xFF09;&#xFF1A;
bolt is workding:a
bolt is workding:b
bolt is workding:c

//spout&#x8BBE;&#x7F6E;2&#x4E2A;&#x7EBF;&#x7A0B;&#x60C5;&#x51B5;&#x4E0B;
bolt is workding:a
bolt is workding:b
bolt is workding:c
bolt is workding:a
bolt is workding:b
bolt is workding:c
</code></pre><hr>
<h3 id="transient">transient</h3>
<p><strong>&#x6CE8;&#x610F;</strong>&#xFF1A;metric&#x90FD;&#x5B9A;&#x4E49;&#x4E3A;&#x4E86;transient&#x3002;&#x56E0;&#x4E3A;&#x8FD9;&#x4E9B;Metric&#x5B9E;&#x73B0;&#x90FD;&#x6CA1;&#x6709;&#x5B9E;&#x73B0;Serializable&#xFF0C;&#x800C;&#x5728;storm&#x7684;spout/bolt&#x4E2D;&#xFF0C;&#x6240;&#x6709;&#x975E;transient&#x7684;&#x53D8;&#x91CF;&#x90FD;&#x5FC5;&#x987B;Serializable </p>
<hr>
<h3 id="bolt-&#x751F;&#x547D;&#x5468;&#x671F;">Bolt &#x751F;&#x547D;&#x5468;&#x671F;</h3>
<p>Bolt &#x662F;&#x8FD9;&#x6837;&#x4E00;&#x79CD;&#x7EC4;&#x4EF6;&#xFF0C;&#x5B83;&#x628A;&#x5143;&#x7EC4;&#x4F5C;&#x4E3A;&#x8F93;&#x5165;&#xFF0C;&#x7136;&#x540E;&#x4EA7;&#x751F;&#x65B0;&#x7684;&#x5143;&#x7EC4;&#x4F5C;&#x4E3A;&#x8F93;&#x51FA;&#x3002;&#x5B9E;&#x73B0;&#x4E00;&#x4E2A; bolt &#x65F6;&#xFF0C;&#x901A;&#x5E38;&#x9700;&#x8981;&#x5B9E;&#x73B0; IRichBolt &#x63A5;&#x53E3;&#x3002;Bolts &#x5BF9;&#x8C61;&#x7531;&#x5BA2;&#x6237;&#x7AEF;&#x673A;&#x5668;&#x521B;&#x5EFA;&#xFF0C;&#x5E8F;&#x5217;&#x5316;&#x540E;&#x63D0;&#x4EA4;&#x7ED9;&#x96C6;&#x7FA4;&#x4E2D;&#x7684;&#x4E3B;&#x673A;&#x3002;&#x7136;&#x540E;&#x96C6;&#x7FA4;&#x542F;&#x52A8;&#x8FDB;&#x7A0B;&#x53CD;&#x5E8F;&#x5217;&#x5316; bolt&#xFF0C;&#x8C03;&#x7528; prepare<em>**</em>&#xFF0C;&#x6700;&#x540E;&#x5F00;&#x59CB;&#x5904;&#x7406;&#x5143;&#x7EC4;&#x3002;</p>
<hr>
<h3 id="bolt-&#x7ED3;&#x6784;">Bolt &#x7ED3;&#x6784;</h3>
<p>Bolts&#x62E5;&#x6709;&#x5982;&#x4E0B;&#x65B9;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-java">declareOutputFields(OutputFieldsDeclarer declarer)
    &#x4E3A;bolt&#x58F0;&#x660E;&#x8F93;&#x51FA;&#x6A21;&#x5F0F;
prepare(java.util.Map stormConf, TopologyContext context, OutputCollector collector)
    &#x4EC5;&#x5728;bolt&#x5F00;&#x59CB;&#x5904;&#x7406;&#x5143;&#x7EC4;&#x4E4B;&#x524D;&#x8C03;&#x7528;
execute(Tuple input)
    &#x5904;&#x7406;&#x8F93;&#x5165;&#x7684;&#x5355;&#x4E2A;&#x5143;&#x7EC4;
cleanup()
    &#x5728;bolt&#x5373;&#x5C06;&#x5173;&#x95ED;&#x65F6;&#x8C03;&#x7528;
</code></pre>
<hr>
<h2 id="&#x516D;&#x3001;&#x8BA1;&#x91CF;&#x5668;">&#x516D;&#x3001;&#x8BA1;&#x91CF;&#x5668;</h2>
<p>&#x5F85;</p>
<hr>
<h2 id="&#x4E03;&#x3001;storm-ui">&#x4E03;&#x3001;Storm UI</h2>
<p>&#x4F20;&#x9001;&#x95E8;&#xFF1A;<a href="https://blog.csdn.net/hua0704/article/details/48394063" target="_blank">Storm UI&#x8BE6;&#x89E3;</a></p>
<hr>
<h2 id="&#x95EE;&#x9898;">&#x95EE;&#x9898;</h2>
<ol>
<li>spout&#x3001;bolt&#x5BF9;&#x8C61;&#x5185;&#xFF0C;&#x5982;&#x4F55;&#x907F;&#x514D;&#x521D;&#x59CB;&#x5316;&#x5BF9;&#x8C61;&#xFF1F;&#x5982;&#x4F55;&#x5F15;&#x5165;&#x8BBF;&#x95EE;&#x6570;&#x636E;&#x5E93;&#x5BF9;&#x8C61;&#xFF1F;redis&#xFF1F;mongodb&#xFF1F;&#x7B54;&#xFF1A;<a href="http://www.aboutyun.com/forum.php?mod=viewthread&amp;tid=17854" target="_blank">http://www.aboutyun.com/forum.php?mod=viewthread&amp;tid=17854</a></li>
<li>&#x5982;&#x4F55;&#x5E73;&#x884C;&#x4E0D;&#x540C;&#x7684;bolt&#xFF1F;&#x5982;&#x4F55;&#x6C47;&#x603B;&#x4E0D;&#x540C;&#x7684;bolt&#xFF1F;&#x7B54;&#xFF1A;&#x521B;&#x5EFA;&#x62D3;&#x6251;&#x65F6;&#xFF0C;&#x540C;&#x65F6;&#x5EFA;&#x7ACB;&#x5E73;&#x884C;&#x4E0D;&#x540C;&#x7684;bolt&#xFF0C;&#x4F46;&#x4E0D;&#x540C;&#x7684;bolt&#x6240;&#x521B;&#x5EFA;&#x7684;tuple&#xFF0C;&#x53EF;&#x4EE5;&#x5F15;&#x5BFC;&#x5230;&#x540C;&#x4E00;&#x4E2A;bolt&#x5904;&#x7406;&#xFF0C;&#x4F46;&#x8BE5;bolt&#x4F1A;&#x521B;&#x5EFA;&#x4E24;&#x4EFD;&#x5B9E;&#x4F8B;&#xFF0C;&#x5185;&#x90E8;&#x5BF9;&#x8C61;&#x4E0D;&#x5171;&#x4EAB;&#x3002;</li>
<li>spout&#x5982;&#x4F55;&#x5BF9;&#x63A5;rabbitmq&#xFF1F;&#x7B54;&#xFF1A;&#x4F7F;&#x7528;storm-rabbitmq</li>
<li>storm&#x5206;&#x5E03;&#x5F0F;&#x8BFB;&#x53D6;&#x53CA;&#x66F4;&#x65B0;&#x4E1A;&#x52A1;&#x914D;&#x7F6E;&#xFF1F;&#x7B54;&#xFF1A;&#x4F7F;&#x7528;storm config&#xFF0C;&#x901A;&#x8FC7;addConfiguration()api&#x6DFB;&#x52A0;</li>
<li>storm streaming&#x4F20;&#x9012;&#x5F3A;&#x7C7B;&#x578B;&#x5BF9;&#x8C61;&#xFF1F;&#x7B54;&#xFF1A;&#x53C2;&#x8003;&#x4F8B;&#x5B50;com.tg.stormgo121.serializable</li>
<li>&#x8C03;&#x8BD5;&#x4E0E;&#x65E5;&#x5FD7;&#xFF1A;logback&#x5982;&#x4F55;&#x914D;&#x7F6E;&#xFF1F;log&#x65E5;&#x5FD7;&#x5728;&#x96C6;&#x7FA4;&#x53CA;&#x672C;&#x5730;&#x6A21;&#x5F0F;&#x4E0B;&#x5206;&#x522B;&#x7684;&#x5B58;&#x653E;&#x76EE;&#x5F55;&#xFF1F;&#x7B54;&#xFF1A;p122</li>
</ol>
<hr>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; tgor.top 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2020-04-23 15:32:53
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../category/OLAP.html" class="navigation navigation-prev " aria-label="Previous page: OLAP">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../category/数据运营.html" class="navigation navigation-next " aria-label="Next page: 数据运营">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"流式计算Storm学习笔记","level":"1.12.1","depth":2,"next":{"title":"数据运营","level":"1.13","depth":1,"path":"category/数据运营.md","ref":"category/数据运营.md","articles":[{"title":"增长黑客-数据运营","level":"1.13.1","depth":2,"path":"数据运营/增长黑客数据运营.md","ref":"数据运营/增长黑客数据运营.md","articles":[]}]},"previous":{"title":"OLAP","level":"1.12","depth":1,"path":"category/OLAP.md","ref":"category/OLAP.md","articles":[{"title":"流式计算Storm学习笔记","level":"1.12.1","depth":2,"path":"数据处理/storm学习笔记.md","ref":"数据处理/storm学习笔记.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["chapter-fold","splitter","tbfed-pagefooter","page-toc-button","-search","search-pro","popup","back-to-top-button","code","copy-code-button"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy tgor.top 2019","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"splitter":{},"search-pro":{"cutWordLib":"nodejieba","defineWord":["Gitbook Use"]},"popup":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"fontsettings":{"theme":"sepia","family":"serif","size":1},"highlight":{},"page-toc-button":{"maxTocDepth":2,"minTocSize":2},"back-to-top-button":{},"copy-code-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"tgor","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"tgor note","gitbook":"*","description":"tgor生活工作记录"},"file":{"path":"数据处理/storm学习笔记.md","mtime":"2020-04-23T07:32:53.391Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-29T08:43:24.127Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

